package jiwei.dao;

import jiwei.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class UserDaoImpl implements UserDao {
    @Autowired
    JdbcTemplate jdbcTemplate; //注入JdbcTemplate

    public void add(User user) {
        //创建sql语句
        String sql = "insert into `user`(name, createTime) values(?,?)";
        Object[] args = {user.name, user.createTime};
        //调用方法
        jdbcTemplate.update(sql, args);
    }

}
